#include <bits/stdc++.h>
using namespace std;
int main() {
	int a, b,c, d;
	cin >> a >> b >> c >> d;
	int ab = a * 60 + b;
	int cd = c * 60 + d;
	int ret = cd - ab;
	cout << ret / 60 << " " << ret % 60;
	return 0;
}
